using System.Collections.Generic;

namespace NewGameTypes
{
	public class TransportList
	{
		private string[] idFreeCars = new string[4] { "_car_dodje_ChelendjerRace", "_CarEscaladeCadillacRace", "_CarSedanRace", "_SantaCarRace" };

		private string[] idFreeTanks = new string[3] { "_car_tank_leopardFree", "_CarTankFree", "_CarTankT70Free" };

		private string[] idFreeTitans = new string[0];

		public List<ProductCar> GetActualTransportList(GameModesUI.TransportType type)
		{
			List<Product> list = new List<Product>();
			switch (type)
			{
			case GameModesUI.TransportType.car:
			{
				list = MarketController.Instance.GetListPurchasetCar();
				string[] array2 = idFreeCars;
				foreach (string id2 in array2)
				{
					list.Add(MarketController.Instance.GetProduct(id2));
				}
				break;
			}
			case GameModesUI.TransportType.tank:
			{
				list = MarketController.Instance.GetListPurchasetTank();
				string[] array3 = idFreeTanks;
				foreach (string id3 in array3)
				{
					list.Add(MarketController.Instance.GetProduct(id3));
				}
				break;
			}
			case GameModesUI.TransportType.titan:
			{
				list = MarketController.Instance.GetListPurchasetTitan();
				string[] array = idFreeTitans;
				foreach (string id in array)
				{
					list.Add(MarketController.Instance.GetProduct(id));
				}
				break;
			}
			}
			if (list.Count == 0)
			{
				return new List<ProductCar>();
			}
			List<ProductCar> list2 = new List<ProductCar>();
			foreach (Product item in list)
			{
				if (item is ProductCar)
				{
					bool flag = false;
					ProductCar productCar = (ProductCar)item;
					if (type == GameModesUI.TransportType.car && productCar.notForRace)
					{
						flag = true;
					}
					if (!flag)
					{
						list2.Add(productCar);
					}
				}
			}
			list2.Sort((ProductCar a, ProductCar b) => a.sortWeight.CompareTo(b.sortWeight));
			return list2;
		}
	}
}
